import HRDCCustomerApi from '@/api/HRDCCustomer.api.js'
export default {
  data () {
    return {
    }
  },
  methods: {
    // 下载附件
    downLoadAttachment (id, fileName) {
      HRDCCustomerApi.DownLoadAttachment({
        id: id
      }).then(res => {
        let blob = new Blob([res.data], { type: 'application/octet-stream' })
        if ('download' in document.createElement('a')) {
          let objectUrl = URL.createObjectURL(blob)
          console.log(objectUrl)
          // let objectUrl = URL.createObjectURL(new Blob([res.data],{type: 'application/octet-stream'}))
          // 文件地址
          const link = document.createElement('a')
          link.download = fileName
          link.href = objectUrl
          link.click()
        } else {
          navigator.msSaveBlob(blob, fileName)
        }
      })
    }
  }
}
